import { createApp } from 'vue'
import App from './views/app.vue'
import router from './router/index.js'
import store from './store/index.js'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import axios from 'axios'
import './api/interceptor.js'

const app = createApp(App)

// 全局配置Axios
axios.defaults.baseURL = 'http://localhost:8000'
app.config.globalProperties.$axios = axios

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 确保 Element Plus 正确安装
app.use(ElementPlus, {
  // 可选的全局配置
  size: 'default'
})
app.use(store)
app.use(router)
app.mount('#app')